package com.neusoft.neuiotms.dcom.converter;

import org.springframework.stereotype.Component;

import com.neusoft.bizcore.web.dto.AbstractConverter;
import com.neusoft.neuiotms.dcom.dto.FunctionalUserDTO;
import com.neusoft.neuiotms.dcom.model.FunctionalUser;

@Component
public class FunctionalUserConverter extends AbstractConverter<FunctionalUser, FunctionalUserDTO> {

    @Override
    public FunctionalUser toModel(final FunctionalUserDTO dto) {

        final FunctionalUser model = new FunctionalUser();

        model.setName(dto.getName());
        model.setCode(dto.getCode());

        return model;
    }

    @Override
    public FunctionalUserDTO toDTO(final FunctionalUser model, final boolean forListView) {

        final FunctionalUserDTO dto = new FunctionalUserDTO();

        dto.setId(model.getId());
        dto.setName(model.getName());
        dto.setCode(model.getCode());

        return dto;
    }

}
